<template>
  <el-col class="info-wrapper" :span="23">
    <el-form
      ref="form"
      :model="searchParams"
      class="search-from main-content"
      label-width="120px"
    >
      <el-col class="search-col">
        <el-form-item label="组织名称" prop="groupName">
          <el-input v-model="searchParams.groupName"></el-input>
        </el-form-item>
        <el-form-item label="组织人数" prop="groupNumber">
          <el-input v-model="searchParams.producer"></el-input>
        </el-form-item>
        <el-form-item label="组织代码" prop="groupId">
          <el-input v-model="searchParams.groupId"></el-input>
        </el-form-item>
      </el-col>
      <el-col class="search-col">
        <el-form-item label="合作单位" prop="cooperativeUnits">
          <el-input v-model="searchParams.cooperativeUnits"></el-input>
        </el-form-item>
        <el-form-item label="省份" prop="province">
          <el-select
            v-model="searchParams.province"
            placeholder="请选择"
          >
            <el-option
              v-for="item in provinceList"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="客户级别" prop="customerGrade">
          <el-select
            v-model="searchParams.customerGrade"
            placeholder="请选择"
          >
            <el-option
              v-for="item in customerGradeList"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col class="search-col">
        <el-form-item label="联系人" prop="contacts">
          <el-input v-model="searchParams.contacts"></el-input>
        </el-form-item>
        <el-form-item label="联系手机" prop="contactsTel">
          <el-input v-model="searchParams.contactsTel"></el-input>
        </el-form-item>
        <el-form-item label="组织电话" prop="groupTel">
          <el-input v-model="searchParams.groupTel"></el-input>
        </el-form-item>
      </el-col>
      <el-col class="search-col">
        <el-form-item label="工厂编号" prop="companyId">
          <el-input v-model="searchParams.companyId"></el-input>
        </el-form-item>
      </el-col>
      <el-col class="search-col operation-area">
        <el-button type="primary" @click="search">搜索</el-button>
        <el-button @click="reset">清空</el-button>
        <el-button @click="batchExport">批量导出</el-button>
      </el-col>
    </el-form>

    <el-tabs class="table-tabs" type="border-card">
      <el-tab-pane>
        <span slot="label">客户信息查询 {{ tableData.length }}</span>
        <el-table border :data="tableData">
          <el-table-column prop="date" label="组织注册名称"> </el-table-column>
          <el-table-column prop="date" label="省份"> </el-table-column>
          <el-table-column prop="date" label="合作单位"> </el-table-column>
          <el-table-column prop="date" label="客户级别"> </el-table-column>
          <el-table-column prop="date" label="联系人"> </el-table-column>
          <el-table-column prop="date" label="联系人手机"> </el-table-column>
          <el-table-column prop="date" label="联系人邮箱"> </el-table-column>
          <el-table-column prop="date" label="组织电话"> </el-table-column>
          <el-table-column prop="date" label="组织传真"> </el-table-column>
          <el-table-column prop="date" label="组织人数"> </el-table-column>
          <el-table-column prop="operation" label="操作">
            <el-link type="primary" style="margin-right: 8px" @click="editTableRow">修改</el-link>
            <el-link type="primary" @click="deleteTableRow">删除</el-link>
          </el-table-column>
        </el-table>
      </el-tab-pane>
    </el-tabs>
  </el-col>
</template>

<script>
export default {
  name: 'companySearch',
  data() {
    return {
      defulatParams: {
        groupName: "", // 组织名称
        groupNumber: "", // 组织人数
        groupId: "", // 组织代码
        province: "", // 省份
        customerGrade: "", // 客户级别
        contacts: "", // 联系人
        contactsTel: "", // 联系手机
        groupTel: "", // 组织电话
        companyId: "", // 工厂编号
      },
      searchParams: {
        ...this.defulatParams,
      },
      tableData: [{date: 123}], // 表格数据
      provinceList: [], // 省份列表
      customerGradeList: [], // 客户等级列表
    };
  },
  mounted() {
      
  },
  methods: {
    search() {
      // todo: 搜索方法
    },
    reset() {
      this.searchParams = {
        ...this.defulatParams
      };
      this.search();
    },
    batchExport() {
      // todo: 批量导出方法
    },
    queryTableData() {
      // todo：获取表格数据
    },
    deleteTableRow() {
      // todo：删除接口
      this.search();
    },
    editTableRow() {
      // todo：编辑详情接口
    }
  },
};
</script>

<style lang="less" scoped>
.info-wrapper {
  font-family: Source Han Sans CN;
  font-weight: 400;
  height: 100%;

  .search-from {
    display: flex;
    flex-wrap: wrap;
    border: 1px solid #c2d9e6;
    padding-top: 20px;
    margin-bottom: 20px;

    .search-col {
      display: flex;
    }

    .operation-area {
      margin-left: 20px;
      margin-bottom: 10px;
    }
  }
}
</style>
